﻿package com.bizmlib.managers
{
	import flash.display.MovieClip;
	import flash.text.Font;
	import flash.utils.getDefinitionByName;
	
	
	public class FontsManager
	{
		
		public static function handleLoadedFonts(fontsHost:IFontsHostable, fontsLib:MovieClip, fontClasses:Array):void
		{
			fontsHost.attachFonts(fontsLib);
			
			for each(var fontClassName:String in fontClasses)
			{
				try
				{
					var fontClass:Class = getDefinitionByName(fontClassName) as Class;
					if(fontClass)
						Font.registerFont(fontClass);
				}
				catch(e:Error)
				{
					//...
				}
			}
		}
	}
}